package com.xyd.servlet;

import com.xyd.entity.ProductCategory;
import com.xyd.service.ProductCategoryService;
import com.xyd.service.impl.ProductCategoryServiceImpl;
import com.xyd.util.JsonUtil;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 类描述：
 *
 * @author 张吉哲
 * @date 2021/1/11 20:26
 */
@WebServlet("/productCategoryAdminGetAllServlet")
public class ProductCategoryAdminGetAllServlet extends HttpServlet {

  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    ProductCategoryService productCategoryService = new ProductCategoryServiceImpl();
    List<ProductCategory> productCategoryList = productCategoryService.adminGetAllCategory();

    JsonUtil.toJson(response, productCategoryList);
  }

  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    doPost(request, response);
  }
}
